package com.practice.controller;

import com.practice.config.ResultData;
import com.practice.dto.RequestDto3;
import com.practice.service.AccUserService;
import com.practice.vo.AccUserVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created by IntelliJ IDEA2021.3
 * @Author: Tenghw
 * @Date: 2022/12/10  21:40
 * @Description:
 */
@Slf4j
@RestController
@RequestMapping("/page")
public class PaHelpController {

    @Autowired
    AccUserService accUserService;

    //@PostMapping(value = "/queryByAny",consumes = "application/json")
    //public Page<AccUserVo> queryByAny(@RequestBody RequestDto2 requestDto2){
    //    log.info(requestDto2.getRole()+"------"+requestDto2.getId());
    //    log.info("requestDto2前台入参为 231>>> {}",requestDto2);
    //    List<AccUserVo> result= accUserService.queryByAny(requestDto2);
    //    //PageInfo<AccUserVo> pageInfo = new PageInfo<>(result);
    //    Page<AccUserVo> page = (Page<AccUserVo>)result;//可直接强转
    //    return page;
    //}

    //@PostMapping(value = "/queryByAny",consumes = "application/json")
    //public ResultData queryByAny(@RequestBody RequestDto2 requestDto2){
    //    log.info(requestDto2.getRole()+"------"+requestDto2.getId());
    //    log.info("requestDto2前台入参为 && >>> {}",requestDto2);
    //    PageInfo<AccUserVo> pageInfo = accUserService.queryByAny(requestDto2);
    //    return new ResultData(200,"分页成功",pageInfo);
    //}

    //@PostMapping(value = "/queryByAny",consumes = "application/json")
    //public ResultData queryByAny(@RequestBody RequestDto3 requestDto3){
    //    log.info(requestDto3.getRole()+"------"+requestDto3.getId());
    //    log.info("requestDto3前台入参为 && >>> {}",requestDto3);
    //    PageInfo<AccUserVo> pageInfo = accUserService.queryByAny(requestDto3);
    //    return new ResultData(200,"分页成功133",pageInfo);
    //}

    @PostMapping(value = "/queryByAny",consumes = "application/json")
    public ResultData queryByAny(@RequestBody RequestDto3 requestDto3){
        log.info(requestDto3.getRole()+"------"+requestDto3.getId());
        log.info("requestDto3前台入参为 &1& >>> {}",requestDto3);
        List<AccUserVo> list = accUserService.queryByAny(requestDto3);
        return new ResultData(200,"分页成功133",list);
    }
}
